package com.whiskeydroid.android.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

import android.util.Log;
import android.widget.Toast;
import com.whiskeydroid.android.core.BaseService;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by IntelliJ IDEA.
 * User: slim
 * Date: Dec 20, 2010
 * Time: 3:54:50 PM
 * To change this template use File | Settings | File Templates.
 */
public class FeedCheckService extends BaseService {

    private Timer mTimer = new Timer();
    private int INTERVAL = 1000 * 20; //60 * 5;

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        stopservice();
    }

    @Override
    public void onStart(Intent intent, int startid) {
        super.onStart(intent, startid);

        startservice();

    }

    private void startservice() {

        
        mTimer.scheduleAtFixedRate(new TimerTask() {
            public void run() {
                Log.e(LOGNAME,"**** FeedCheckService FIRE!!!");
                
            }
        }, 0, INTERVAL);

    }

    private void stopservice() {

        if (mTimer != null) {

            mTimer.cancel();

        }

    }
}